package cn.ym.mall.service.impl;

import cn.ym.mall.dao.CityDao;
import cn.ym.mall.dao.impl.CityDaoImpl;
import cn.ym.mall.entity.Activity;
import cn.ym.mall.entity.City;
import cn.ym.mall.service.CityService;
import cn.ym.mall.utils.DruidUtils;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 * @author 漆家乐
 */
public class CityServiceImpl implements CityService {
    CityDao cityDao = new CityDaoImpl();
    /**
     * 查询对应省份的市
     *
     * @param fatherId
     * @return
     * @throws SQLException
     */
    @Override
    public List<City> getCity(String fatherId) throws SQLException {
        Connection conn = null;
        List<City> cityList = new ArrayList<>();
        try {
            conn = DruidUtils.getConnection();
            cityList = cityDao.getCity(fatherId);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            DruidUtils.close();
        }
        return cityList;
    }
}
